#!/usr/bin/python
#coding=utf-8
from math import sin,cos,pow
from prop import *
#Здесь можно определить свои функции
def f_lin(arr):

    [k,q,v]=map(To_p,arr[0:3])
#    [k,q,v]=arr[0:3]
    [a,b]=arr[3:5]
    [A,B]=arr[5:7]


    f=pow(delta_1(q),4)*pow(1-B,2)*delta_1(v)*(-4*pow(q,2)*(-4*k*q*cos(b) - 4*B*pow(q,2))*(-2*k*v*cos(a) - 2*A*pow(k,2))/(pow((1 + 2*B*k*q*cos(b) + pow(k,2) + pow(B,2)*pow(q,2)),3)*pow((1 + 2*A*k*v*cos(a) + pow(v,2) + pow(A,2)*pow(k,2)),2)) - 4*pow(q,2)*(-2*k*v*cos(a) - 2*A*pow(k,2))*(-2*k*q*cos(b) - 2*B*pow(q,2))/(pow((1 + 2*B*k*q*cos(b) + pow(k,2) + pow(B,2)*pow(q,2)),3)*pow((1 + 2*A*k*v*cos(a) + pow(v,2) + pow(A,2)*pow(k,2)),2)) + (-6*k*q*cos(b) - 6*B*pow(q,2))*(-4*k*q*cos(b) - 4*B*pow(q,2))*(-2*k*v*cos(a) - 2*A*pow(k,2))*(-2*k*q*cos(b) - 2*B*pow(q,2))/(pow((1 + 2*B*k*q*cos(b) + pow(k,2) + pow(B,2)*pow(q,2)),4)*pow((1 + 2*A*k*v*cos(a) + pow(v,2) + pow(A,2)*pow(k,2)),2)));
    f=f*jack_p([k,q,v])*jack_a_1(arr[3:5]);
    return f

def f_lin_1(arr):
    [k,q,v]=map(To_p,arr)
    f=delta_1(k)*delta_1(k)*delta_1(k)*delta_1(q)*delta_1(q)*delta_1(q)*delta_1(v)*delta_1(v)*delta_1(v)*jack_p([k,q,v])
    return f
